package my_jwt

import (
	"github.com/golang-jwt/jwt/v5"
	"time"
)

func generate(secret string) (string, error) {
	var claims = jwt.MapClaims{
		"exp": time.Now().Add(time.Hour * 24).Unix(), // 过期时间
		"iat": time.Now().Unix(),                     // 签发时间
	}

	var token = jwt.NewWithClaims(jwt.SigningMethodHS256, claims)
	return token.SignedString([]byte(secret))
}
